package com.thm.tfast.core.utils;

import cn.hutool.core.util.HashUtil;
import cn.hutool.crypto.digest.DigestUtil;
import cn.hutool.crypto.digest.MD5;
import com.thm.tfast.core.sevruity.domain.SysUserDetails;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @author THM
 * @date 2022/10/24
 * @desc SecurityUtil
 */
public class SecurityUtil {

    public static SysUserDetails getCurrentUser(){
        SysUserDetails userDetails = (SysUserDetails) SecurityContextHolder
                .getContext()
                .getAuthentication()
                .getPrincipal();
        return userDetails;
    }

    public static void main(String[] args) {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        String encode = bCryptPasswordEncoder.encode("043950549e7ce0e1e95856516147886ef890b7b8676842c9b4f8135a8d27c5f2");
        System.out.println(encode);
    }
}
